/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gitbox;

import com.mysql.jdbc.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Maulnick
 */
public class UserModel {
    private Connections connection;
    public UserModel(Connections con){
        connection = con;
    }
    public boolean matchUsernamePassword(String username, String password){
        // Mengembalikan IdUser
        String query = "SELECT user.iduser FROM user WHERE user.username = '" + username + "' AND user.password = '" + password + "'";
        boolean result = false;
        try {
          Statement stmt = (Statement) connection.getconnection().createStatement();
          ResultSet rs = stmt.executeQuery(query);
          while(rs.next()){
              result = true;
          }
        } catch (SQLException e ) {
          result = false;
        }
        return result;
    }
}
